/* This is a modified version of a class from the Dashboard app.
 *  Modification 2012 by Stephane Ribas
 * The original copyright and license information follows.
 *
 * Copyright (C) 2011 Wglxy.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.ribas.stephane;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import android.os.Bundle;
import android.webkit.WebView;

/**
 * This is the Help activity 
 *
 */


public class AboutActivity extends HomeoGratuitActivity 
{

protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView (R.layout.activity_about);
    setTitleFromActivityLabel (R.id.titleAbout);
   
	WebView engine = (WebView) findViewById(R.id.webViewAbout);
	engine.loadData(readTxt(), "text/html", "UTF-8");
	
}
  
    
private String readTxt() {
        InputStream inputStream = getResources().openRawResource(R.raw.apropos);
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        int i;
        try {
                i = inputStream.read();
                while (i != -1) {
                        byteArrayOutputStream.write(i);
                        i = inputStream.read();
            }
            inputStream.close();
        } 
        catch (IOException e) {
        	// pb de lecture avec le fichier lisezmoi?
        	e.printStackTrace();
        }
        return byteArrayOutputStream.toString();
        
}

/**
 * onDestroy
 * The final call you receive before your activity is destroyed. 
 * This can happen either because the activity is finishing (someone called finish() on it, 
 * or because the system is temporarily destroying this instance of the activity to save space. 
 * You can distinguish between these two scenarios with the isFinishing() method.
 *
 */


protected void onDestroy ()
{
    if (db != null) db.close();
	super.onDestroy ();
}

    
} // end class
